<template>
	<view>
		<view class="gk-search">
			<u-search placeholder="请输入组织名称关键词..." bgColor="#ffffff" v-model="keyword" :clearabled="true"
				:showAction="false"></u-search>
			<u-button><u-icon name="plus" color="#1095db" size="13"
					style="margin-right: 10rpx;font-size: 26rpx;"></u-icon>发起活动</u-button>
		</view>
		<u-tabs :list="list" @click="click" :scrollable="false"></u-tabs>
		<view class="">
			<view v-for="(item,index) in activityList" :key="index">
				<u-row class="list-item">
					<u-col :span="4">
						<img :src="item.coverImg" alt="" style="width: 220rpx;height: 160rpx;" />
					</u-col>
					<u-col :span="8">
						<view
							style="display: flex;justify-content: space-between;flex-direction: column;padding-left: 20rpx;">
							<view class="title">{{item.title}}</view>
							<view style="color: #999999;margin-bottom: 10rpx;">{{item.formattedbeginDateDate}} 至
								{{item.formattedendDateDate}}</view>
							<view
								style="color: #999999;display: flex;align-items: center;justify-content: space-between;">

								{{item.orgName}}
								<u-button :plain="true" type="error"
									style="width: 170rpx;margin-right: 0;height: 25px;font-size: 26rpx;padding: 0;">活动已结束</u-button>
							</view>
						</view>
					</u-col>
				</u-row>
			</view>
		</view>
	</view>
</template>

<script>
	import mock from './mock';
	import dayjs from 'dayjs';
	export default {
		data() {
			return {
				keyword: "",
				list: [{
					name: '全部',
				}, {
					name: '进行中',
				}, {
					name: '未开始'
				}, {
					name: '已结束'
				}, ],
				activityList: []
			};
		},
		onLoad() {
			mock.data.rows.forEach(item => {
				item.beginDateData = dayjs(item.beginDate)
				item.formattedbeginDateDate = item.beginDateData.format('YYYY-MM-DD')
				item.endDateData = dayjs(item.endDate)
				item.formattedendDateDate = item.endDateData.format('YYYY-MM-DD')
			})
			this.activityList = mock.data.rows
		},
		methods: {
			click(item) {
				console.log('item', item);
			},
		}
	}
</script>

<style lang="scss" scoped>
	.gk-search {
		padding: 20rpx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		background: #f2f2f2;

		.u-button {
			width: 170rpx;
			margin-left: 20rpx;
			height: 34px;
			color: #1095db;
			padding: 0;
			font-size: 26rpx;
			border: none;
		}
	}


	.list-item {
		padding: 20rpx;
		border-bottom: 1px solid #f2f2f2;
		font-size: 24rpx;
		.title {
			margin-bottom: 10rpx;width: 100%;
			display: -webkit-box;
			-webkit-box-orient: vertical;
			-webkit-line-clamp: 2;
			overflow: hidden;
			text-overflow: ellipsis;
			font-size: 28rpx;
		}
	}
</style>